home *** CD-ROM | disk | FTP | other *** search
- /*
- ==============================================================================
-
- bigray Ray Gun
-
- ==============================================================================
- */
-
- #include "g_local.h"
- #include "m_bigray.h"
-
-
- static int sound_pain;
- static int sound_die;
- static int sound_idle;
- static int sound_punch;
- static int sound_sight;
- static int sound_search;
-
-
-
- void bigray_search (edict_t *self)
- {
- gi.sound (self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0);
- }
-
-
- void bigray_fidget (edict_t *self);
- mframe_t bigray_frames_stand [] =
- {
- ai_stand, 0, bigray_fidget,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL
-
- };
- mmove_t bigray_move_stand = {FRAME_stand01, FRAME_stand06, bigray_frames_stand, NULL};
-
- void bigray_stand (edict_t *self)
- {
- self->monsterinfo.currentmove = &bigray_move_stand;
- }
-
- mframe_t bigray_frames_stand_fidget [] =
- {
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL,
- ai_stand, 0, NULL
- };
- mmove_t bigray_move_stand_fidget = {FRAME_stand01, FRAME_stand06, bigray_frames_stand_fidget, bigray_stand};
-
- void bigray_fidget (edict_t *self)
- {
- if (self->monsterinfo.aiflags & AI_STAND_GROUND)
- return;
- if (random() > 0.15)
- return;
-
- self->monsterinfo.currentmove = &bigray_move_stand_fidget;
- gi.sound (self, CHAN_WEAPON, sound_idle, 1, ATTN_IDLE, 0);
- }
-
-
- mframe_t bigray_frames_walk [] =
- {
- ai_walk, 0, NULL,
- ai_walk, 0, NULL,
- ai_walk, 0, NULL,
- ai_walk, 0, NULL,
- ai_walk, 0, NULL,
- ai_walk, 0, NULL
- };
- mmove_t bigray_move_walk = {FRAME_stand01, FRAME_stand06, bigray_frames_walk, NULL};
-
- void bigray_walk (edict_t *self)
- {
- self->monsterinfo.currentmove = &bigray_move_walk;
- }
-
-
- mframe_t bigray_frames_run1 [] =
- {
- ai_run, 0, NULL,
- ai_run, 0, NULL,
- ai_run, 0, NULL,
- ai_run, 0, NULL,
- ai_run, 0, NULL,
- ai_run, 0, NULL
- };
- mmove_t bigray_move_run1 = {FRAME_stand01, FRAME_stand06, bigray_frames_run1, NULL};
-
- void bigray_run (edict_t *self)
- {
- //if (self->monsterinfo.aiflags & AI_STAND_GROUND)
- //self->monsterinfo.currentmove = &bigray_move_stand;
- // else
- self->monsterinfo.currentmove = &bigray_move_run1;
- }
-
-
- void bigray_attack_spike (edict_t *self)
- {
- static vec3_t aim = {MELEE_DISTANCE, 0, -24};
- fire_hit (self, aim, (15 + (rand() % 6)), 100); // Faster attack -- upwards and backwards
- }
-
-
- void bigray_swing (edict_t *self)
- {
- gi.sound (self, CHAN_WEAPON, sound_punch, 1, ATTN_NORM, 0);
- }
-
- void bigrayShot (edict_t *self)
- {
- vec3_t forward, right;
- vec3_t start;
- vec3_t end;
- vec3_t dir;
- vec3_t from;
- int damage = 50;
- int flash_number = MZ2_MAKRON_BFG;
- trace_t tr;
-
- AngleVectors (self->s.angles, forward, right, NULL);
- G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
- VectorCopy (self->s.origin, start);
- VectorCopy (self->enemy->s.origin, end);
- end[2] += self->enemy->viewheight;
- VectorSubtract (end, start, dir);
- //right[0] = right[0] * 6;
- //right[1] = right[1] * 6;
- //VectorAdd(start, right, start);
- end[2] = end[2] - 32;
- start[2] = start[2] + 46;
- VectorCopy (start, from);
- tr = gi.trace (from, NULL, NULL, end, self, MASK_SHOT);
- VectorCopy (tr.endpos, from);
-
- gi.WriteByte (svc_temp_entity);
- gi.WriteByte (TE_SHOTGUN);
- gi.WritePosition (start);
- gi.WritePosition (end);
- gi.multicast (start, MULTICAST_PHS);
-
- gi.sound (self, CHAN_VOICE, sound_punch, 1, ATTN_NORM, 0);
-
- if ((tr.ent != self) && (tr.ent->takedamage))
- T_Damage (tr.ent, self, self, dir, tr.endpos, tr.plane.normal, damage, 0, 0, MOD_HYPERBLASTER);
- else if (!((tr.surface) && (tr.surface->flags & SURF_SKY)))
- {
- gi.WriteByte (svc_temp_entity);
- gi.WriteByte (TE_SCREEN_SPARKS);
- gi.WritePosition (tr.endpos);
- gi.WriteDir (tr.plane.normal);
- gi.multicast (self->s.origin, MULTICAST_PVS);
- }
-
- gi.WriteByte (svc_temp_entity);
- gi.WriteByte (TE_EXPLOSION1);
- gi.WritePosition (end);
- gi.multicast (end, MULTICAST_PVS);
- }
-
-
- void bigray_attack_club (edict_t *self)
- {
- vec3_t aim;
-
- VectorSet (aim, MELEE_DISTANCE, self->mins[0], -4);
- fire_hit (self, aim, (5 + (rand() % 6)), 400); // Slower attack
- }
-
- mframe_t bigray_frames_attack_shoot [] =
- {
- ai_charge, 0, NULL,
- ai_charge, 0, NULL,
- ai_charge, 0, NULL,
- ai_charge, 0, NULL,
- ai_charge, 0, bigrayShot,
- ai_charge, 0, NULL,
- ai_charge, 0, NULL
- };
- mmove_t bigray_move_attack_shoot = {FRAME_stand01, FRAME_stand06, bigray_frames_attack_shoot, bigray_run};
-
-
- void bigray_sight (edict_t *self, edict_t *other)
- {
- gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
-
- }
-
- void bigray_attack (edict_t *self)
- {
- self->monsterinfo.currentmove = &bigray_move_attack_shoot;
- }
-
- mframe_t bigray_frames_pain1 [] =
- {
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL
- };
- mmove_t bigray_move_pain1 = {FRAME_stand01, FRAME_stand06, bigray_frames_pain1, bigray_run};
-
- void bigray_pain (edict_t *self, edict_t *other, float kick, int damage)
- {
- if (self->health < (self->max_health / 2))
- self->s.skinnum = 1;
-
- if (level.time < self->pain_debounce_time)
- return;
-
- self->pain_debounce_time = level.time + 3;
- gi.sound (self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0);
- self->monsterinfo.currentmove = &bigray_move_pain1;
- }
-
-
- void bigray_dead (edict_t *self)
- {
- VectorSet (self->mins, -16, -16, -42);
- VectorSet (self->maxs, 16, 16, -8);
- self->movetype = MOVETYPE_TOSS;
- self->svflags |= SVF_DEADMONSTER;
- self->nextthink = 0;
- gi.linkentity (self);
-
- }
-
-
- mframe_t bigray_frames_death1 [] =
- {
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL,
- ai_move, 0, NULL
-
-
- };
- mmove_t bigray_move_death1 = {FRAME_stand01, FRAME_stand05, bigray_frames_death1, bigray_dead};
-
- void bigray_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
- {
- int n;
-
- gi.sound (self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0);
-
- gi.WriteByte (svc_temp_entity);
- gi.WriteByte (TE_EXPLOSION1);
- gi.WritePosition (self->s.origin);
- gi.multicast (self->s.origin, MULTICAST_PVS);
-
- for (n = 0; n < 8; n++)
- ThrowGib (self, "models/objects/gibs/mart_gut/tris.md2", damage, GIB_ORGANIC, EF_GREENGIB);
-
- ThrowHead (self, "models/objects/gibs/mart_head/tris.md2", damage, GIB_ORGANIC, EF_GREENGIB);
-
- self->deadflag = DEAD_DEAD;
- }
-
-
- /*QUAKED monster_bigray (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
- */
- void SP_monster_bigray (edict_t *self)
- {
- if (deathmatch->value)
- {
- G_FreeEdict (self);
- return;
- }
-
- // pre-caches
- sound_pain = gi.soundindex ("bigray/fizz.wav");
- sound_die = gi.soundindex ("bigray/fizz.wav");
- sound_idle = gi.soundindex ("bigray/weird2.wav");
- sound_punch = gi.soundindex ("bigray/shoot.wav");
- sound_search = gi.soundindex ("bigray/weird2.wav");
- sound_sight = gi.soundindex ("bigray/weird2.wav");
-
- self->s.modelindex = gi.modelindex("models/monsters/martian_raygun/tris.md2");
- self->s.modelindex2 = gi.modelindex("models/monsters/hi_res/martian_bigray/tris.md2");
-
- VectorSet (self->mins, -16, -16, -8);
- VectorSet (self->maxs, 16, 16, 48);
- self->movetype = MOVETYPE_STEP;
- self->solid = SOLID_BBOX;
-
- self->max_health = 250;
- self->health = self->max_health;
- self->gib_health = 0;
- self->mass = 250;
-
- self->pain = bigray_pain;
- self->die = bigray_die;
-
- self->monsterinfo.stand = bigray_stand;
- self->monsterinfo.walk = bigray_walk;
- self->monsterinfo.run = bigray_run;
- self->monsterinfo.dodge = NULL;
- self->monsterinfo.attack = bigray_attack;
- self->monsterinfo.melee = bigray_attack;
- self->monsterinfo.sight = bigray_sight;
- self->monsterinfo.search = bigray_search;
-
- self->monsterinfo.currentmove = &bigray_move_stand;
- self->monsterinfo.scale = MODEL_SCALE;
-
- gi.linkentity (self);
-
- walkmonster_start (self);
- }
-